import { createWebHashHistory, createWebHistory, createRouter } from 'vue-router'

// 路由守卫
import guarder from '@/helper/guarder.js'

// 页面布局
import layout from '../extension/layout.vue'

// 公共路由
export const constantRoutes = [
	{
		path: '/',
		component: layout,
		redirect: '/index',
		children: [
			{
				path: 'index',
				name: 'index',
				component: () => import('../views/comprehensive/home/index.vue'),
				meta: { title: '综合集控总览' }
			},
			{
				path: 'comprehensive/fully-mechanized-face/302',
				name: 'fullyMechanizedFace302',
				component: () => import('../views/comprehensive/FullyMechanizedFace/302.vue'),
				meta: { title: '302综采面' }
			},
			{
				path: 'comprehensive/fully-mechanized-face/403',
				name: 'fullyMechanizedFace403',
				component: () => import('../views/comprehensive/FullyMechanizedFace/403.vue'),
				meta: { title: '403综采面' }
			},
			{
				path: 'comprehensive/tunnelling',
				name: 'comprehensive/tunnelling',
				component: () => import('../views/comprehensive/tunnelling.vue'),
				meta: { title: '智能掘进' }
			},
			{
				path: 'comprehensive/transportation',
				name: 'comprehensive/transportation',
				component: () => import('../views/comprehensive/transportation.vue'),
				meta: { title: '主煤流运输' }
			},
			{
				path: 'comprehensive/ventilate',
				name: 'comprehensive/ventilate',
				component: () => import('../views/comprehensive/ventilate.vue'),
				meta: { title: '主通风系统' }
			},
			{
				path: 'comprehensive/localVentilation',
				name: 'comprehensive/localVentilation',
				component: () => import('../views/comprehensive/localVentilation.vue'),
				meta: { title: '局部通风系统' }
			},
			{
				path: 'comprehensive/takeGas',
				name: 'comprehensive/takeGas',
				component: () => import('../views/comprehensive/takeGas.vue'),
				meta: { title: '瓦斯抽放系统' }
			},
			{
				path: 'comprehensive/electric',
				name: 'comprehensive/electric',
				component: () => import('../views/comprehensive/electric.vue'),
				meta: { title: '电力监控系统' }
			},
			{
				path: 'comprehensive/drain',
				name: 'comprehensive/drain',
				component: () => import('../views/comprehensive/drain.vue'),
				meta: { title: '供排水系统' }
			},
			{
				path: 'comprehensive/pressure',
				name: 'comprehensive/pressure',
				component: () => import('../views/comprehensive/pressure.vue'),
				meta: { title: '压风系统' }
			}
		]
	},
	{
		path: '/monitoring',
		component: layout,
		children: [
			{
				path: 'Integrated',
				name: 'Integrated',
				component: () => import('../views/monitoring/Integrated/index.vue'),
				meta: { title: '综合监测一张图' }
			},
			{
				path: 'security',
				name: 'security',
				component: () => import('../views/monitoring/security/index.vue'),
				meta: { title: '安全监测' }
			},
			{
				path: 'hydrologic',
				name: 'hydrologic',
				component: () => import('../views/monitoring/hydrologic/index.vue'),
				meta: { title: '水文监测' }
			},
			{
				path: 'microSeismic',
				name: 'microSeismic',
				component: () => import('../views/monitoring/microSeismic/index.vue'),
				meta: { title: '微震监测' }
			},
			{
				path: 'fire',
				name: 'fire',
				component: () => import('../views/monitoring/fire/index.vue'),
				meta: { title: '区域防灭火监测' }
			},
			{
				path: 'pressure',
				name: 'pressure',
				component: () => import('../views/monitoring/pressure/index.vue'),
				meta: { title: '顶板与冲击地压监测' }
			},
			{
				path: 'abnormal',
				name: 'abnormal',
				component: () => import('../views/monitoring/abnormal/index.vue'),
				meta: { title: '异常告警' }
			}
		]
	},
	{
		path: '/MakeDecision',
		component: layout,
		children: [
			{
				path: 'secure',
				name: 'secure',
				component: () => import('../views/MakeDecision/secure/index.vue'),
				meta: { title: '安全决策分析' }
			},
			{
				path: 'produce',
				name: 'produce',
				component: () => import('../views/MakeDecision/produce/index.vue'),
				meta: { title: '生产决策分析' }
			},
			{
				path: 'Production',
				name: 'Production',
				component: () => import('../views/MakeDecision/Production/index.vue'),
				meta: { title: '产销一体化监测' }
			},
			{
				path: 'EmergencyCommand',
				name: 'EmergencyCommand',
				component: () => import('../views/MakeDecision/EmergencyCommand/index.vue'),
				meta: { title: '应急指挥一张图' }
			},
			{
				path: 'scheduling',
				name: 'scheduling',
				component: () => import('../views/MakeDecision/scheduling/index.vue'),
				meta: { title: '生产调度一张图' }
			},
			{
				path: 'efficiency',
				name: 'efficiency',
				component: () => import('../views/MakeDecision/efficiency/index.vue'),
				meta: { title: '日采煤能效分析' }
			},
			{
				path: 'emergency',
				name: 'emergency',
				component: () => import('../views/MakeDecision/emergency/index.vue'),
				meta: { title: '应急指挥信息收集与发布' }
			}
		]
	},
	{
		path: '/login',
		name: '/login',
		component: () => import('../extension/login/login.vue'),
		meta: {
			title: '登陆页面',
			hideTabs: true
		}
	},
	{
		path: '/404',
		name: '/404',
		component: () => import('../extension/my-404.vue'),
		meta: {
			title: '404页面'
		}
	},
	{
		path: '/:pathMatch(.*)',
		name: '/:pathMatch(.*)',
		redirect: '/404'
	}
]

const router = createRouter({ history: import.meta.env.VITE_APP_BASE_BASE ? createWebHashHistory() : createWebHistory(), routes: constantRoutes })

guarder(router)

export default router
